package com.csun.cmny.provider.service.impl;

import com.csun.cmny.provider.dao.ExamineMapper;
import com.csun.cmny.provider.dao.OldmanMapper;
import com.csun.cmny.provider.dto.ExamineDto;
import com.csun.cmny.provider.pojo.Oldman;
import com.csun.cmny.provider.service.ExamineService;

import com.csun.cmny.provider.vo.ExamineManVo;
import com.csun.cmny.provider.vo.ExamineVo;
import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Map;

@Transactional
@Service("examineService")
public class ExamineServiceImpl implements ExamineService {

    @Resource
    private ExamineMapper examineMapper;



    // 添加体检记录
    @Override
    public int insert(ExamineDto examine) {
        int n = examineMapper.insertSelective(examine);
        return n;
    }

    // 根据记录id 删除数据
    @Override
    public int delete(ExamineDto examine) {
    	

        int n = examineMapper.deleteByPrimaryKey(examine.getId());

        return n;
    }

    // 修改记录
    @Override
    public int update(ExamineDto examine){
        int n = examineMapper.updateByPrimaryKeySelective(examine);
        return n;
    }

    // 查询单条体检记录
    @Override
    public ExamineVo selectByID(ExamineDto examine){
        return examineMapper.selectByPrimaryKey(examine);
    }

    // 根据oldmanId查询记录
    @Override
    public List<ExamineVo> selectByoldmanId(Integer oldmanid){
        return examineMapper.selectByoldmanId(oldmanid);
    }


    // 综合查询
    @Override
    public List<ExamineVo> examineShowAll(Map<String, Object> queryParam){
        List<ExamineVo> list = examineMapper.examineShowAll(queryParam);
        return list;
    }

    @Override
    public List<ExamineManVo> selectOldmans(Integer homeid) {
        return examineMapper.selectOldmans(homeid);
    }


}
